﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace BaoJian.Control
{
    /// <summary>
    /// 展示最新资讯。
    /// ColType1的辅助功能控件
    /// </summary>
    public partial class ColType12 : System.Web.UI.UserControl
    {
        public int PortalID;      
       // public int SubTotal;
        public int TitleLen;
        public int Start;
        public int End;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LYQ.BLL.Portal bll = new LYQ.BLL.Portal();
                DataTable dt = bll.GetList("PortalID =" + PortalID + " ORDER BY PLevel desc").Tables[0];

                DataRowCollection dr = dt.Rows;
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                for (int i = Start; i <= End && i < dr.Count; i++)
                {
                    sb.Append("<li><a href=\"col.aspx?p=" + (dr[i]["ColumnID"] as string) +
                        "\" target=\"_blank\">" + (dr[i]["ColumnName"] as string) +
                        "</a> | <a href=\"c.aspx?id=" + dr[i]["DocID"] as string + "\" target=\"_blank\">");

                    string t = (dr[i]["DocTitle"] as string);
                    if (t.Length > TitleLen)
                        sb.Append(t.Substring(0, TitleLen) + "</a></li>");
                    else
                        sb.Append(t + "</a></li>");
                }

                Literal1.Text = sb.ToString();

            }
        }
    }
}